
package com.nikmesoft.android.alwaysontime.adapters;

import java.util.List;

import com.nikmesoft.android.alwaysontime.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.nikmesoft.android.alwaysontime.models.sms_mainItem;

;

public class smsMainAdapter extends ArrayAdapter<sms_mainItem>{
	private int resourceID;

	public smsMainAdapter(Context context, int resourceID,
			List<sms_mainItem> objects){
		super(context, resourceID, objects);
		this.resourceID = resourceID;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent){
		sms_mainItem item = getItem(position);
		View row = convertView;
		if (row == null){
			LayoutInflater inflater;
			inflater = (LayoutInflater) getContext().getSystemService(
					Context.LAYOUT_INFLATER_SERVICE);
			row = inflater.inflate(this.resourceID, null);
		}

		TextView tvContent = (TextView) row.findViewById(R.id.sms);
		TextView tvPhone = (TextView) row.findViewById(R.id.smsPhone);
		TextView tvType = (TextView) row.findViewById(R.id.smsType);
		TextView tvDate = (TextView) row.findViewById(R.id.smsDate);
		tvContent.setText(item.getContent());
		tvPhone.setText(item.getPhone());
		tvType.setText(item.getType());
		tvDate.setText(item.getDate());

		return row;
	}

}
